<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%
'#-------------------------------------------------------------------------------#
'#  Description:       HLA Epitope Frequency Search - Select several pops. 	     #
'#                     Code: pop_selection.asp                                   #
'#  Author:            Louise Takeshita					                         #
'#  Created:           05 Feb 2014.                                              #
'#  Ended:             05 Feb 2014.                                              #
'#  Last update:       05 Feb 2014.                                              #
'#  Version:           1.0.0 - 05 Feb 2014                                       #
'#  Bugs:                                                                        #
'#-------------------------------------------------------------------------------#
%>
<!-- PAGE DESCRIPTION -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Description" content="Allele Frequencies Website" />
<meta name="Keywords" content="HLA, Epitope, KIR, cyotkines, TAP, MIC, mHags, frequencies" />
<link rel="shortcut icon" href="../images/favicon.ico" />
<title>The Allele Frequency Net Database [HLA Epitope Populations]</title>

<!-- CSS STYLE SHEETS -->
<link rel="stylesheet" type="text/css" href="../styles/format.css" />

<!-- JAVASCRIPT FUNCTIONS -->
<script type="text/javascript" src="../routines/functions.js"> </script>
<script type="text/javascript" src="../routines/ajaxPopSel.js"> </script>
<script type="text/javascript" src="routines/EpiFunctions.js"> </script>
</head>

<body onload="fctFillValues();" bgcolor="#EEEEEE">
<%
		'//... Setting up variables ...//
		sHla_locus = Request.QueryString("hla_locus")		
		sHla_locus_type = Request.QueryString("epitope_type")
		sHla_pop_selection = Request.QueryString("hla_pop_selection")
		
		'//... Detect tokens for populations ...//'
		sSelection = sHla_pop_selection
		iLength = Len(sSelection)
		iTokens = 0
		sTemp = ""
		iJ = 1
		Dim aTokens(20)
		For iI = 0 To 19
			aTokens(iI) = ""
		Next
		For iI = 1 To iLength
			If Left(sSelection, 1) = "," or iI = iLength Then
				If iI = iLength Then
					aTokens(iJ) = sTemp & Left(sSelection, 1)
				Else
					aTokens(iJ) = sTemp
				End If
				iJ = iJ + 1
				sTemp = ""
			Else
				sTemp = sTemp & Left(sSelection, 1)
			End If
			sSelection = Right(sSelection, iLength - iI)
		Next
		iTokens = iJ - 1
%>
<%
'#-----------------------------#
'#   D E T A I L               #
'#-----------------------------#
%>
<div id="divGenDetail" style="background-color:#EEEEEE;">	
	<form>
	<table class="tblNormal" bgcolor="#EEEEEE">	
		<tr>
			<td align="center">
				<input type="hidden" name="hla_pop_selection" id="hla_pop_selection" value="<%=sHla_pop_selection%>" />
				<textarea disabled="disabled" cols="51" rows="3" name="hla_pop_selection2" id="hla_pop_selection2"><%Response.Write(sHla_pop_selection)%></textarea>
			</td>
		</tr>
		<tr>
			<td>
				<div id="pop_selection0" style="border:1px solid black; width:375px; background-color:#DDDDDD;">			
				<table>
					<tr>
						<td width="200"><font color='#003366'>Select your pops</font></td>
						<td width="170" align="right"><a href='#' onclick='ajaxPopSelClear();fctFillPopSel(this);'>Clear All</a></td>
					</tr>
				</table>
<div id="pop_selection" style="overflow:scroll; width:370px; height:200px; background-color:white; padding:0px 0px 0px 5px; 
                            border-top:1px solid black; overflow-x:hidden;">
<%
			If sHla_locus_type <> "" Then
%>							
<!-- #include file = "conn/curOpenDB_01.asp" -->
<!-- #include file = "conn/curOpenRS_01.asp" -->
<%			
				Response.Write("<table>")
				
				strSQL = "SELECT DISTINCT epit_popname, pop_afndid, epit_pop_n FROM hla_epitopes.epit_pops " & _
						 "ORDER BY epit_popname "
				rsRecordset.Open strSQL, dbConnection
				While Not rsRecordset.EOF
					sValue = Trim(rsRecordset("epit_popname"))
					sValue2 = Trim(rsRecordset("pop_afndid"))
					sValue3 = Trim(rsRecordset("epit_pop_n"))
					Response.Write("<tr><td>")
%>
					<input type="checkbox" name="hla_pops" value="<%Response.Write(sValue)%>" onclick="fctFillPopSel(this);" />				
<%			
					Response.Write(sValue & " (n=" & sValue3 & ")")
					Response.Write("</td></tr>")
					rsRecordset.MoveNext
				WEnd
				Response.Write("</table>")
%>
<!-- #include file = "conn/curCloseRS_01.asp" -->
<!-- #include file = "conn/curCloseDB_01.asp" -->		
<%
			End If
%>
</div>
</div>
			</td></tr>
			<tr>			
				<td align="center">
					<input type="button" value="OK" style="width:80px;" onclick="fctAssignValue();fctCleanSinglePop();window.close();" />
					<input type="button" value="Cancel" style="width:80px;" onclick="window.close();" />
				</td>
			</tr>
	</table>
	</form>
</div>
</body>
</html>
